package ExerciseOne;

public class StaticAccountTest {

	public static void main(String[] args) {
		Acount.setInterestRate(2.0);
		Acount acut1 = new Acount("123",100);
//		System.out.println("acut1——>"+"ID:"+acut1.getId()+",pwd:"+acut1.getPwd()+
//				            ",balance:"+acut1.getBalance()+",interestRate:"+
//				            acut1.getInterestRate()+",minMoney:"+acut1.getMinMoney());
		Acount acut2 = new Acount("234",200);
//		System.out.println("acut2——>"+"ID:"+acut2.getId()+",pwd:"+acut2.getPwd()+
//	            ",balance:"+acut2.getBalance()+",interestRate:"+
//	            acut2.getInterestRate()+",minMoney:"+acut2.getMinMoney());
		Acount acut3 = new Acount("456",300);
//		System.out.println("acut3——>"+"ID:"+acut3.getId()+",pwd:"+acut3.getPwd()+
//	            ",balance:"+acut3.getBalance()+",interestRate:"+
//	            acut3.getInterestRate()+",minMoney:"+acut3.getMinMoney());
		System.out.println(acut1);
		System.out.println(acut2);
		System.out.println(acut3);
	}

}

class Acount
{
	private int id;//账号
	private String  pwd ="000000";//初始密码
	private double balance;//余额
	
	private static double interestRate;//利率
	private static double minMoney = 1.0;//最小存款余额
	private static int inital = 1001;//用于自动生成id
	
	public Acount()
	{
		id = inital++;
	}
	
	public Acount(String pwd, double balance) {
		this();
		this.pwd = pwd;
		this.balance = balance;
	}



	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public double getBalance() {
		return balance;
	}

	public void setBalance(double balance) {
		this.balance = balance;
	}

	public static double getInterestRate() {
		return interestRate;
	}

	public static void setInterestRate(double interestRate) {
		Acount.interestRate = interestRate;
	}

	public static double getMinMoney() {
		return minMoney;
	}

	public static void setMinMoney(double minMoney) {
		Acount.minMoney = minMoney;
	}

	@Override
	public String toString() {
		return "Acount [id=" + id + ", pwd=" + pwd + ", balance=" + balance + "]";
	}
	
}